const {Controller} = require("egg")
const fs = require("fs")
const path = require("path")
class unLinkController extends Controller{
    async index(){
        try {
            const target = this.ctx.params.target
            let targetPath = path.join(this.config.baseDir, "app/public/uploads", target)
            fs.unlinkSync(targetPath)
            this.ctx.body = {
                code:20000,
                targetPath
            }

        }catch (e){
            this.ctx.body={
                code:50000,

            }
        }
    }
}

module.exports = unLinkController